'use strict'


let pubsub = require('./PubsubSys.js');
// let pubsub = require('./PubsubAsync.js');


class ClassB {
    constructor() {
        let self = this;
        console.log('ClassB subscribe [eat] event');
        pubsub.subscribe('eat', function(eatWhat) {
            console.log('receive [eat] event, now handle it');
            self.handleEat(eatWhat);
        });
    }

    handleEat(what) {
        console.log('handleEat', what);
    }
}

module.exports = ClassB;